
  <?php 
        $status = $po->getApprovalstatus()?  $po->getApprovalstatus()  : 0;
        $action = CommonValues::$gMRApprovalStatus['action'][$status];
        ?>
<td>
<ul class="sf_admin_td_actions">
   <li>
    <?
        if ($status == CommonValues::$gMRApprovalStatus['key']['Approved'] &&  $sf_user->hasCredential('EDIT_PO'))
            echo link_to(image_tag('/sf/sf_admin/images/date.png', array('alt' => __('Change Date'), 'title' => __('Change Date'))), 'po/ChangeDate?id='.$po->getId());
    ?>
 </li>  
  <li><?php

  echo link_to(image_tag('/sf/sf_admin/images/edit.png', array('alt' => __('change no'), 'title' => __('change no'))), 'po/changeNumber?id='.$po->getId());

  if ($status == CommonValues::$gMRApprovalStatus['key']['Initial']) echo link_to(image_tag('/sf/sf_admin/images/delete_icon.png', array('alt' => __('delete'), 'title' => __('delete'))), 'po/delete?id='.$po->getId(), array (
  'post' => true,
  'confirm' => __('Are you sure you want to delete this PO?'),
)); else
    {
      if ($sf_user->hasGroup('Administrator')) {
          echo link_to(image_tag('/sf/sf_admin/images/delete_icon.png', array('alt' => __('delete'), 'title' => __('delete'))), 'po/delete?id='.$po->getId(), array (
        'post' => true,
        'confirm' => __('Are you sure you want to delete this PO? This action will also delete all TI related.'),
));
      }
    }
    ?></li>

<li>
<?

        if ($action=='COMPLETED') {
            if ($status == CommonValues::$gMRApprovalStatus['key']['Waiting for approval']) {
                echo link_to(image_tag('/sf/sf_admin/images/' .  'cancel_icon.png', array('alt' =>'cancel', 'title' => 'cancel')), 'po/cancel?id='.$po->getId(), array ('post' => true,
      'confirm' => __('Are you sure you want to cancel?'),
    ));
            }
            if ($status == CommonValues::$gMRApprovalStatus['key']['Approved']) {
                echo link_to(image_tag('/sf/sf_admin/images/' .  'cancel_icon.png', array('alt' =>'cancel', 'title' => 'cancel')), 'po/cancel?id='.$po->getId(), array ('post' => true,
      'confirm' => __('Are you sure you want to cancel?'),
    ));
                echo link_to(image_tag('/sf/sf_admin/images/' .  'revise_icon.png', array('alt' =>'revise', 'title' => 'revise')), 'po/revise?id='.$po->getId(), array ('post' => true,
      'confirm' => __('Are you sure you want to revise?'),
    ));
            }
        } else {
            echo link_to(image_tag('/sf/sf_admin/images/' . $action. '_icon.png', array('alt' =>$action, 'title' => $action)), 'po/'.$action.'?id='.$po->getId(), array ('post' => true,
      'confirm' => __('Are you sure you want to '.$action.'?'),
    ));
        }
    ?>
    </li>
<li>
<?
if ($status == CommonValues::$gMRApprovalStatus['key']['Rejected'])
    echo link_to(image_tag('/sf/sf_admin/images/viewnotes_icon.png', array('alt' => __('view notes'), 'title' => __('view notes'))), 'po/viewNotes?id='.$po->getId());
?>
</li>
<li>
<?
        if ($status != CommonValues::$gMRApprovalStatus['key']['Initial'])
            echo link_to(image_tag('/sf/sf_admin/images/print.png', array('alt' => __('print'), 'title' => __('print'))), 'po/print?id='.$po->getId());
    ?>
</li>
    
</ul>
</td>
